<?php
App::uses('AppModel', 'Model');
/**
 * Product Model
 *
 * @property Warehouse $Warehouse
 * @property PurchaseDetail $PurchaseDetail
 * @property SalesDetail $SalesDetail
 * @property MobileModel $MobileModel
 */
class Product extends AppModel {

/**
 * Use database config
 *
 * @var string
 */
	public $useDbConfig = 'connection_local';

/**
 * Primary key field
 *
 * @var string
 */
	public $primaryKey = 'product_id';

/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'product_code';

/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'product_code' => array(
			'maxLength' => array(
				'rule' => array('maxLength', 10),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'serial_number' => array(
			'maxLength' => array(
				'rule' => array('maxLength',10),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
	public $belongsTo = array(
		'Warehouse' => array(
			'className' => 'Warehouse',
			'foreignKey' => 'warehouse_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'PurchaseDetail' => array(
			'className' => 'PurchaseDetail',
			'foreignKey' => 'purchase_detail_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'SalesDetail' => array(
			'className' => 'SalesDetail',
			'foreignKey' => 'sales_detail_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'MobileModel' => array(
			'className' => 'MobileModel',
			'foreignKey' => 'mobile_model_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
}
